<%@page import="java.util.Calendar"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="com.qijia.travel.app.*"  %>
<%@ page import="com.qijia.travel.domain.*"  %>
<%@ page import="com.qijia.travel.vo.*"  %>
<%@page import="com.qijia.travel.helper.ObjectHelper"%>
<%@page import="com.qijia.travel.helper.DateHelper"%>
<%@ page import="com.qijia.travel.common.*"  %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<title>后台管理平台--旅游网</title>
<link rel="stylesheet" type="text/css" href="../css/layout.css" />
<script language="javascript" type="text/javascript" src="<%=basePath%>js/selectall.js"></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>js/trchgcolor.js"></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>js/DownPullMenu.js"></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>js/listOrder.js"></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>js/displayLayer.js"></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>js/calendar.js"></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>js/popupdiv_shim.js"></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>js/ajaxPopup.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath%>js/ymPrompt/skin/qq/ymPrompt.css" />
<script type="text/javascript" src="<%=basePath%>js/ymPrompt/ymPrompt.js"></script>
</head>
<%
request.setCharacterEncoding("UTF-8");
ConsumptionManager conManager = new ConsumptionManager();
TouristGroupVo vo = (TouristGroupVo)ObjectHelper.ConvertURLRequsetMapToObj(request.getParameterMap(),TouristGroupVo.class);

if(null==vo.getStDate() || null==vo.getEdDate()){
  Calendar today = Calendar.getInstance(); 
  today.add(Calendar.MONTH,-2);
  vo.setStDate(DateHelper.getThisMonthFirstDay(today));
  vo.setEdDate(DateHelper.getMonthEndDay());
}

if(null==vo.getDateCode()){
 vo.setDateCode(Constants.DATETYPE_GROUP_END_DATE_CODE);
}

vo.setACode(0);
vo.setOrderBy("tgdStartDt");
PageResult pageObj = conManager.selectConsumptionListByVo(vo);
 %>
 <c:set var="vo" value="<%=vo%>" />
<body>
<div id="wrapper">
    <!--头部菜单开始-->
    <jsp:include page="../common/TopMenu.jsp"></jsp:include>
    <!--头部菜单结束-->
	<div id="BreadCrumb">我的位置：团消费管理 &gt; 团消费列表</div>
	<div id="REC_content">
	    <fieldset id="TalentLib" class="mainField">
		    <legend><span class="title">团消费列表</span></legend>
			<div class="innerCon">
			    <form name="TalentLibForm" action="" method="post">
				<!--表头搜索条开始-->
				<div class="mainSearchBox">
				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="editTab">
					<tr height="35">
						<td width="80" class="title">关键字</td>
						<td width="295" >
						<select name="searchCode" style="text-align: left;">
						    <option value="0" ></option>
							<option value="1" <%if(null!=vo.getSearchCode()&&vo.getSearchCode()==1)out.print("selected");%>>导游姓名</option>
							<option value="3" <%if(null!=vo.getSearchCode()&&vo.getSearchCode()==3)out.print("selected");%>>导游编号</option>
							<option value="6" <%if(null!=vo.getSearchCode()&&vo.getSearchCode()==6)out.print("selected");%>>团编号</option>
						</select> 
						<input type="text" name="searchKeyword" value="<%=vo.getSearchKeyword()==null?"":vo.getSearchKeyword()%>" size="25" /></td>
						<td width="160">
						  <input type="submit" name="searchButton" class="newSearchButton" value="查询" onclick="document.TalentLibForm.action='<%=basePath%>work/consumption.jsp';"/> 
						</td>
					</tr>
					<tr>
						<td class="title" height="30">日期</td>
						<td colspan="4">
						<select name="dateCode">
							<option value="3" <%if(null!=vo.getDateCode()&&vo.getDateCode()==3)out.print("selected");%>>起始日期</option>
							<option value="4" <%if(null!=vo.getDateCode()&&vo.getDateCode()==4)out.print("selected");%>>截止日期</option>
						</select>
						<input type="text" id="startImg" name="stDate" size="10" readonly="readonly" value="<%=vo.getStDate()==null?"":vo.getStDate()%>" onclick="fPopCalendar(document.getElementById('startImg'),document.getElementById('startImg'));return false;" onkeydown="iniTxt_OnKeydown(event,this);" />
					  --<input type="text" id="endImg" name="edDate" size="10" readonly="readonly" value="<%=vo.getEdDate()==null?"":vo.getEdDate()%>" onclick="fPopCalendar(document.getElementById('endImg'),document.getElementById('endImg'));return false;" onkeydown="iniTxt_OnKeydown(event,this);" />
						</td>
					</tr>
				</table>
				</div>
				<!--表头搜索条结束-->
				
			    <!-- begin tab -->
			    <div class="topControl clearfix">
				    <div id="TalentLibTabCon" class="itemTabCon">
					    <ul id="TalentLibTabs" class="itemTabs">
					        <li id="onlineTab" class="blur"><a href="<%=basePath%>baseInfo/guideManage.jsp" onfocus="this.blur()">导游状态管理</a></li>
						    <li id="onlineTab" class="blur"><a href="<%=basePath%>work/tourist.jsp" onfocus="this.blur()">排团管理</a></li>
					        <li id="onlineTab" class="focus"><a href="<%=basePath%>work/consumption.jsp" onfocus="this.blur()">团消费管理</a></li>
					        <li id="onlineTab" class="blur"><a href="<%=basePath%>work/expenditure.jsp" onfocus="this.blur()">公司收支管理</a></li>
					        
					    </ul>
				    </div>
					<div class="leftCon"><span id="info" class="infoClass" style="display:none;"></span></div>
                    <div class="toprightCon"></div>
			    </div>
			    <!-- end tab -->
				
				<div id="mainListCon">
						<div class="infoCon clearfix">
						    <div class="leftCon">以下是符合条件的旅游团列表</div>
						    <div class="rightCon">共有 <span class="num"><%=pageObj.getRowCnt()%></span> 个消费项</div>
					    </div>
						<div class="tableCon">
						<table width="100%" border="0" cellpadding="0" cellspacing="0" id="TalentResumeList" class="listTab">
							<tr class="tabHead">
								<td class="blankTd"></td>
								<td width="30" class="centerAlign" nowrap=nowrap>项次</td>
								<td width="60" class="centerAlign">导游姓名</td>
								<td width="80" class="centerAlign" align="center" >团编号</td>
								<td width="80" class="centerAlign" nowrap=nowrap>消费名称</td>
								<td width="100" class="centerAlign" nowrap=nowrap>消费金额</td>
								<td nowrap=nowrap  class="centerAlign" nowrap=nowrap>消费说明</td>
							</tr>
						   
						    <%
							 int i=0;
							   for(Object obj : pageObj.getPageList()){
							   i++;
							     TouristConsumption detail = (TouristConsumption)obj;
							  %>
							<tr class='<%=i%2==0?"list1":"list2"%>'>
								<td class="tdCheckbox">
								  <input type="checkbox" id="<%=detail.getTcId()%>" name="chkid" onclick="unChkSelectAll('chkall')" />
								</td>
								<td class="centerAlign"><a href="#" onclick="ymPrompt.win('newConsumption.jsp?tcId=<%=detail.getTcId()%>',480,480,'修改细节信息',closeWin,null,null,true)"><%=i%></a></td>
								<td class="centerAlign"><a href="#" onclick="ymPrompt.win('newConsumption.jsp?tcId=<%=detail.getTcId()%>',480,480,'修改细节信息',closeWin,null,null,true)"><%=detail.getGuideName()%></a></td>
								<td class="centerAlign"><a href="#" onclick="ymPrompt.win('newTourist.jsp?detailId=<%=detail.getTcTgdId()%>',480,480,'修改细节信息',closeWin,null,null,true)"><%=detail.getTouristGroupSn()==null?"":detail.getTouristGroupSn()%></a></td>
								<td class="centerAlign"><%=detail.getTcName()%></td>
								<td class="centerAlign"><%=detail.getTcAmount()==null?"":detail.getTcAmount()%></td>
								<td class="centerAlign"><%=detail.getTcDesc()==null?"":detail.getTcDesc()%></td>
							</tr>
						 <%
                              }
                              %>
							<tr align="center">
								<td colspan="11"></td>
							</tr>
						</table>
						</div>
						<!--@BeginSHOWPAGE-->
						<div class="turnpageCon clearfix">
							<div class="checkAll">
								<label for="chkall">
								  <input type="checkbox" name="chkall" id="chkall" value="1" onclick="ChkSelectAll('chkid','chkall')"/>全选</label>
						          <input type="hidden" id="curPage" name="curPage" value="${vo.curPage}"/>
						    </div>
							<div class="turnpage">
							  <%=pageObj.getSimpleBar()%>
						    </div>
						</div>
						<div class="bottomControl">
						   <input type="button" value="删除选中项" class="genButton6" onclick="deleteSelected()"/>&nbsp;
						</div>
						<!--@EndSHOWPAGE-->
				</div>
				</form>
			</div>
		</fieldset>
	</div>
	<jsp:include page="../common/Foot.jsp"></jsp:include>
</div>
<script src="<%=basePath%>js/PaginatedTools.js"></script>
<script src="<%=basePath%>dwr/interface/conManager.js"></script>
<script src="<%=basePath%>dwr/engine.js"></script>
<script src="<%=basePath%>js/jquery.js"></script>
<!--部门弹出窗口JS-->
<script language="javascript" type="text/javascript">
function getCheckItems(){
 var details;
 var first=0;
 $("input[name='chkid']").each(function(idx){
   if(this.checked){
      if(first==0){
         details=this.id;
         first=1;
      }else{
         details+=","+this.id;
      }
   }
 });
 return details;
}

function deleteSelected(){
 if(confirm("确定要删除掉选中的细节信息吗?")){
   conManager.deleteTouristConsumption(getCheckItems(),function(data){
     alert(data);
     window.location.reload();
   });
 }else
   return;
}

var errorHandle = function(err){
     alert(err);
}
dwr.engine.setErrorHandler(errorHandle); 

function formSubmit(curPage){
  //window.location.href="tourist.jsp?curPage="+curPage;
  $("#curPage").val(curPage);
  document.TalentLibForm.submit();
}
PaginatedTools.setCallBackFun(formSubmit);
function closeWin(){
}

function outputExcel(){
   document.TalentLibForm.action="<%=basePath%>work/touristImport.jsp";
   document.TalentLibForm.submit();
}
</script>
</body>
</html>
